import request from '@/utils/request'

// 搜索话题
export function searchTopics(data) {
  return request({
    url: '/topic/search',
    method: 'post',
    data
  })
}

// 获取热门话题
export function getHotTopics(limit = 10) {
  return request({
    url: '/topic/hot',
    method: 'get',
    params: { limit }
  })
}

// 根据ID获取话题信息
export function getTopicById(topicId) {
  return request({
    url: `/topic/${topicId}`,
    method: 'get'
  })
}

// 获取话题列表
export function getTopicList(data) {
  return request({
    url: '/topic/list',
    method: 'post',
    data
  })
}

// 关注/取消关注话题
export function toggleFollowTopic(topicId) {
  return request({
    url: `/topic/${topicId}/follow`,
    method: 'post'
  })
}
